package com.blackcat.annotation.async;

import com.blackcat.annotation.async.bean.AsyncBean;
import com.blackcat.annotation.async.config.ThreadPoolConfig;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class App {

    public static void main(String[] args) throws InterruptedException {
        // 容器中读取Bean
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ThreadPoolConfig.class);
        System.out.println(Thread.currentThread().getName()+"主线程请求异步执行asyncMethod");
        AsyncBean asyncBean = (AsyncBean) ctx.getBean("asyncBean");
        asyncBean.asyncMethod();
        System.out.println(Thread.currentThread().getName()+"主线程请求异步执行syncMethod结束");
    }
}
